package com.weixing.mall.provider.controller.rpc;

import com.weixing.mall.base.wrapper.Result;
import com.weixing.mall.base.wrapper.ResultUtil;
import com.weixing.mall.core.support.BaseController;
import com.weixing.mall.provider.api.erp.entity.InDepot;
import com.weixing.mall.provider.api.erp.entity.OutDepot;
import com.weixing.mall.provider.api.erp.query.SkuQuery;
import com.weixing.mall.provider.api.erp.vo.ResultSkuInfoVo;
import com.weixing.mall.provider.api.model.vo.ActivityProductVo;
import com.weixing.mall.provider.erp.service.ErpService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName ProductRpcController
 * @Description
 * @Author Small
 * @Date 2019/10/23 19:00
 * @Version 1.0
 **/
@RestController
@RequestMapping("api/erp")
public class ErpRpcController extends BaseController {
    @Autowired
    private ErpService erpService;

    @GetMapping("selectDepotSkuStockByPage")
    public Result<ResultSkuInfoVo> selectDepotSkuStockByPage(String depotid,
                                                             String styleid,
                                                             String sku) {
        SkuQuery query = new SkuQuery();
        query.setDepotid(depotid);
        query.setStyleid(styleid);
        query.setSku(sku);
        query.setPageindex(1);
        query.setPagesize(10);
        Result<ResultSkuInfoVo> result = erpService.selectDepotSkuStockByPage(query);
        return result;
    }

    @PostMapping("addOutDepot")
    public Result addOutDepot(@RequestBody OutDepot outDepot){
       return erpService.addOutDepot(outDepot);
    }

    @PostMapping("addInDepot")
    public Result addOutDepot(@RequestBody InDepot inDepot){
       return erpService.addInDepot(inDepot);
    }
}
